home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: seebs@solutions.solon.com (Peter Seebach)
- Newsgroups: comp.lang.c
- Subject: Re: Question about C compiler
- Date: 17 Apr 1996 16:34:40 -0500
- Organization: Usenet Fact Police (Undercover)
- Message-ID: <4l3o5g$bso@solutions.solon.com>
- References: <1996Apr16.175344.6042@lafn.org> <16APR199620514504@erich.triumf.ca>
- Reply-To: seebs@solon.com
- NNTP-Posting-Host: solutions.solon.com
-
- In article <16APR199620514504@erich.triumf.ca>,
- P.Bennett <bennett@erich.triumf.ca> wrote:
- >free(ptr) does not change ptr, or the memory ptr points to - it just "marks"
- >the memory as available for future malloc()s.
-
- This is not always true, it is merely the most common implementation.
-
- >After you do free(ptr) you can (but shouldn't) access the "freed" memory,
- >and the data previously stored in it, providing a later malloc() has not used
- >the space.
-
- This is specifically untrue; some implementations flag the memory such that
- an attempt to access it may die screaming.
-
- ANSI says that the value of a pointer to freed space is
- indeterminate, so an implementation has license to run
- through and set all pointers to the space to NULL,
- unlikely though this would be.
-
- -s
- --
- Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
- C/Unix wizard -- C/Unix questions? Send mail for help. No, really!
- Unsolicited email is not welcome, and will be billed for at consulting rates.
- The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
-